
#ifndef _LoginGatewayCommandIn_H_
#define _LoginGatewayCommandIn_H_

#include "command.h"

#pragma pack(1)

namespace Cmd
{
        namespace LoginGateway
        {
                enum {
                        CMDIN_LOGIN             = 0x0010,
                        CMDIN_FORWARD           = 0x0011,
                };

                // CMDIN_LOGIN
                enum {
                        SCMDIN_LOGIN                            = 0x0001,       // 请求登录LoginGatewayServer
                        SCMDIN_LOGIN_RESPONCE                   = 0x0002,       // 登录LoginGatewayServer返回
                };
                // CMDIN_FORWARD
                enum {
                        SCMDIN_FORWARD_CMD_TO_GATEWAY_REQ       = 0x0001,
                        SCMDIN_FORWARD_CMD_TO_GATEWAY_RES       = 0x0002,
                        SCMDIN_FORWARD_CMD_TO_GATEWAY           = 0x0003,
                        SCMDIN_FORWARD_CMD_TO_LOGIN_REQ         = 0x0004,
                        SCMDIN_FORWARD_CMD_TO_LOGIN_RES         = 0x0005,
                        SCMDIN_FORWARD_CMD_TO_LOGIN             = 0x0006,
                };


                // login cmd
                struct stLoginCmd : t_NullCmd
                {
                        stLoginCmd()
                                : t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN)
                        {
                                dest_type_ = LOGINGATEWAYSERVER;
                                server_type_ = 0;
                                server_id_ = 0;
                        }

                        uint16_t dest_type_;
                        uint16_t server_type_;
                        uint16_t server_id_;
                };

                struct stLoginResponce : t_NullCmd
                {
                        stLoginResponce()
                                : t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN_RESPONCE)
                        {
                        }
                };

                // forward cmd
                struct stForwardCmdToGatewayReq : t_NullCmd
                {
                        stForwardCmdToGatewayReq()
                                : t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_CMD_TO_GATEWAY_REQ)
                        {
                                gateway_id_ = 0;
                                fail_ret_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const
                        {
                                return sizeof(*this) + size_*sizeof(data_[0]);
                        }

                        uint8_t fail_ret_;
                        uint16_t gateway_id_;
                        uint16_t size_;
                        uint8_t data_[0];
                };

                struct stForwardCmdToGatewayRes : t_NullCmd
                {
                        stForwardCmdToGatewayRes()
                                : t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_CMD_TO_GATEWAY_RES)
                        {
                                gateway_id_ = 0;
                                ret_code_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const
                        {
                                return sizeof(*this) + size_*sizeof(data_[0]);
                        }

                        uint16_t gateway_id_;
                        uint16_t ret_code_;
                        uint16_t size_;
                        uint8_t data_[0];
                };

                struct stForwardCmdToGateway : t_NullCmd
                {
                        stForwardCmdToGateway()
                                : t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_CMD_TO_GATEWAY)
                        {
                                from_id_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const
                        {
                                return sizeof(*this) + size_*sizeof(data_[0]);
                        }

                        uint16_t from_id_;
                        uint16_t size_;
                        uint8_t data_[0];
                };

                struct stForwardCmdToLoginReq : t_NullCmd
                {
                        stForwardCmdToLoginReq()
                                : t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_CMD_TO_LOGIN_REQ)
                        {
                                login_id_ = 0;
                                fail_ret_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const
                        {
                                return sizeof(*this) + size_*sizeof(data_[0]);
                        }

                        uint8_t fail_ret_;
                        uint16_t login_id_;
                        uint16_t size_;
                        uint8_t data_[0];
                };

                struct stForwardCmdToLoginRes : t_NullCmd
                {
                        stForwardCmdToLoginRes()
                                : t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_CMD_TO_LOGIN_RES)
                        {
                                login_id_ = 0;
                                ret_code_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const
                        {
                                return sizeof(*this) + size_*sizeof(data_[0]);
                        }

                        uint16_t login_id_;
                        uint16_t ret_code_;
                        uint16_t size_;
                        uint8_t data_[0];
                };

                struct stForwardCmdToLogin : t_NullCmd
                {
                        stForwardCmdToLogin()
                                : t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_CMD_TO_LOGIN)
                        {
                                from_id_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const
                        {
                                return sizeof(*this) + size_*sizeof(data_[0]);
                        }

                        uint16_t from_id_;
                        uint16_t size_;
                        uint8_t data_[0];
                };
        };      // namespace LoginGateway
};      // namespace Cmd

#pragma pack() //pack(1)

#endif  // _LoginGatewayCommandIn_H_
